﻿package game {
	
	import flash.system.Security;
	import flash.events.Event;
	
	import game.objects.TextureObject;
	import game.account.DataAccount;
	import game.account.header.HSliderEvent;
	import game.account.shop.ShopCarEvent;
	
	public class Account extends DataAccount {
		
		public function Account():void {
			
			this.addEventListener(Event.ADDED_TO_STAGE, added);
			
		}
		
		private function added(event:Event):void {
			inited();
			
			this.addEventListener		( ShopCarEvent.SELECT,			shopAutoSelect);
			
			header.addEventListener		( HSliderEvent.BUY_AUTO,		buyAutoHandler);
			header.addEventListener		( HSliderEvent.BUY_DONAT,		buyDonatHandler);
			
			//auto.getDetails(null);
			
			stage.addEventListener ( Event.RESIZE, resized ); resized(null);
		}
		
		private function shopAutoSelect(event:ShopCarEvent):void {
			var id:int = event.data.id;
			trace (id);
		}
		
		private function buyAutoHandler(event:HSliderEvent):void { 
			openShopCar();
		}
		
		private function buyDonatHandler(event:HSliderEvent):void { 
			openDonat();
		}
		
		private function resized(event:Event):void {
			if (!stage) return;
			
			viewer.resize (stage.stageWidth, stage.stageHeight);
			
		}
		
	}
	
}

